#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

# -*- mode: python; -*-
Import('BuildEnv')
import platform
import os

env = BuildEnv.Clone()
env.Prepend(CPPPATH = [env['TOP'],
                       env['TOP'] + '/db',
                       env['TOP'] + '/io',
                       env['TOP'] + '/tools/sandesh/library/common',
                       env['TOP'] + '/config-client-mgr'
                      ])

libcontrol_test = env.Library('control_test',
                              ['control_node_test.cc',
                               'network_agent_mock.cc'])

env.Append(LIBPATH = env['TOP'] + '/io')
env.Append(LIBPATH = env['TOP'] + '/db')
env.Append(LIBPATH = env['TOP'] + '/base')
env.Append(LIBPATH = env['TOP'] + '/bgp')
env.Append(LIBPATH = env['TOP'] + '/base/test')
env.Append(LIBPATH = env['TOP'] + '/control-node')
env.Append(LIBPATH = env['TOP'] + '/ifmap')
env.Append(LIBPATH = env['TOP'] + '/net')
env.Append(LIBPATH = env['TOP'] + '/xml')
env.Append(LIBPATH = env['TOP'] + '/xmpp')
env.Append(LIBPATH = env['TOP'] + '/schema')

etcd_incl = os.environ.get('CONTRAIL_ETCD_INCL');

if etcd_incl:
    env.Prepend(LIBS = [
                    'etcdql', 'protobuf', 'grpc++', 'grpc', 'z'])

env.Prepend(LIBS = [
                    'config_client_mgr', 'ifmapio', 'bgp_schema', 'ifmap_vnc',
                    'ifmap_server', 'xmpp', 'peer_sandesh',
                    'sandesh', 'http', 'net', 'http_parser', 'httpc',
                    'curl', 'sandeshvns', 'process_info', 'io', 'control_node',
                    'ifmap_common', 'bgp_schema', 'ifmap_vnc',
                    'pugixml', 'xml', 'task_test', 'db', 'curl',
                    'base', 'gunit', 'crypto', 'ssl', 'boost_regex',
                    'ifmapio', 'libbgp_schema',
                    'libifmap_server', 'libifmap_vnc', 'cassandra_cql',
                    'cassandra', 'gendb', 'httpc',
                    'SimpleAmqpClient', 'rabbitmq',
                    'boost_filesystem', 'boost_program_options', 'boost_chrono'])

if platform.system() != 'Darwin':
    env.Append(LIBS = ['rt'])

options_test = env.UnitTest('options_test', ['../buildinfo.o', '../options.o',
                                             'options_test.cc'])
env.Alias('src/control-node:options_test', options_test)

test_suite = [ options_test ]

test = env.TestSuite('control-node-test', test_suite)
env.Alias('controller/src/control-node:test', test)
Return('test_suite')
